package satir.command;

import java.util.ArrayList;

import satir.SatirGame;
import satir.card.MagicToolCard;
import satir.framework.command.RegularCommand;
import satir.framework.command.State;
import satir.player.Player;

/**
 * The Class ViewStatus. This player command is to retrieve the current status
 * of a player
 * @version 3.0 April 2012
 * @author Creative Family
 */
public class ViewStatusCmd implements RegularCommand {

    /** The satir game. */
    private SatirGame satirGame;

    /**
     * Instantiates a new view status command.
     * @param satirGame
     *            the Satir game
     */
    public ViewStatusCmd(final SatirGame satirGame) {
	this.satirGame = satirGame;
    }

    /**
     * Execute to show player status.
     */
    public void execute() {
	Player targetPlayer = satirGame.getCurrentPlayer();
	System.out.println("Here is the status of [" + targetPlayer.getName()
		+ "]");
	System.out.println("Figure :" + targetPlayer.getFigure());
	System.out.println("Self-Esteem :" + targetPlayer.getSelfEsteem()
		+ "\n");
	ArrayList<MagicToolCard> mtCards = targetPlayer.getMtCards();
	System.out.println("Magic Tool:");
	for (int i = 0; i < mtCards.size(); i++) {
	    System.out.println("- " + mtCards.get(i).getName());
	}
    }

    /**
     * Gets the instruction.
     * @return instruction
     */
    @Override
    public String getInstruction() {
	return "View Status";
    }

    /**
     * Execute the view status.
     * @param state
     *         the State object
     */
    @Override
    public void execute(final State state) {
	execute();
    }
}
